import {ref} from 'vue'
import {defineStore} from 'pinia'
import axios from 'axios'

export const useChannelStore = defineStore('channel', () => {
  const channelList = ref([])

  const getChannelList = async () => {
    const { data: {data} } = await axios.get('http://geek.itheima.net/v1_0/channels')
    channelList.value = data.channels
  }
  return {
    channelList,
    getChannelList
  }
}, {persist: true})
